package com.tchintech.pay.sqllite;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2017/7/18 0018.
 */

public class MysqlLite extends SQLiteOpenHelper {
    //数据库名称
    private static final String sqlname="studio";
    //数据库
    public static  String FIRST="create  table Student (" +
            "id integer primary key autoincrement," +
            "name text," +
            "sex text," +
            "age text)";

    private  Context context;
    //构造函数
    public MysqlLite(Context context) {
        super(context, sqlname, null, 1);
        this.context=context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // TODO 创建数据库后，对数据库的操作
        db.execSQL(FIRST);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO 更改数据库版本的操作
    }

    @Override
    public void onOpen(SQLiteDatabase db) {
        super.onOpen(db);
        // TODO 每次成功打开数据库后首先被执行
    }
}
